<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.yztc.rc.api.framework.manager.UserManager" %>
<%@ page import="com.yztc.rc.api.framework.entity.UserAccount" %>
<%@ page import="net.ssta.common.DataBaseConfig" %>
<%
	String path = request.getContextPath();
	//分页参数
    String userId=request.getParameter("userId");
    UserManager um=UserManager.getInstance(DataBaseConfig.getFrameworkDataSource());
    String loginName=um.getUserAccountByUserId(userId).getLoginName();
    String flag=request.getParameter("flag");
    
    
%>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<link type="text/css" rel="stylesheet" href="<%=path %>/includes/css/commonStyle.css"/> 
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/styleBase.css"/>
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/ostable.css" />
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/tab.css" />



<script type='text/javascript' src="<%=path %>/includes/FusionCharts/js/FusionCharts.js"></script>
<script type='text/javascript' src="<%=path %>/includes/FusionCharts/js/FusionChartsExportComponent.js"></script>

<script type='text/javascript' src="<%=path %>/includes/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/includes/styleBase/js/style.js"></script>
<script type="text/javascript" src="<%=path %>/includes/DatePicker/WdatePicker.js"></script>


<script type="text/javascript" src="<%=path %>/includes/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="<%=path %>/includes/lhgdialog/lhgdialog.js"></script>

<script type="text/javascript" src="<%=path %>/includes/Fvalidate/Fvalidate.js" ></script>
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/Fvalidate/style.css" />

 
<title>扣费</title>
 
<script type="text/javascript">

var dg = frameElement.dg;

$(document).ready(function()
{
    dg.addBtn( 'save', '保存', save );
	dg.addBtn( 'cancel', '取消', cancel );
	$("#searchFrom").Fvalidate({live:true});
	if("<%=flag%>"=="true"){
	    alert("扣费成功!");
	    dg.cancel();
	    dg.win.reloadPage();
	}
});


function checkForm(){


  if(!$("#searchFrom").Fvalidate()){
    return false;
  }


   var v1=$("#money1").val();
   var v2=$("#money2").val();
   if(v1==""){
      alert("请填写扣费金额！");
      return false;
   }
   if(v1!=v2){
      alert("两次输入的扣费金额不一样！");
      return false;
   }
   
   var current=$("#current").val();
   if(parseInt(v1)>parseInt(current)){
   alert("扣除金额不能大于当前剩余金额！");
    return;
   }
   document.pwdFrom.submit();
   return true;
}        
function cancel()
{
  dg.cancel();
}

function save()
{
	checkForm();
}
  
</script>



<style>
body, html {
	margin:0;
	padding:0;
}
	.ctable{
		font-size:12px;
		cellPadding:0px;
		cellSpacing:0px;
		background-color:#F6F9FF;
		
		} 
 
		.ctable tr{
		height:24px; 
		} 
		.ctable tr td{ 
		border:0px;
		border-top:1px #99bbe8 solid; 
		border-right:1px #99bbe8 solid;
		padding:5px; 
		vertical-align:middle;
		}
</style>


</head>
<body>
<form id="searchFrom" action="<%=path %>/back/userPointManager?method=chargeBack"  name="pwdFrom" method="post">
<input type="hidden"    style="width:120px;" class="textInput" value="<%=userId %>" name="userId"/>
<input type="hidden"   id="current" class="textInput" value="<%=request.getParameter("bill")==null?"0":request.getParameter("bill") %>"  />

<div class="multiEditPanel" style="border:0;padding:10px;width:90%;padding-left:20px;">
  <table cellpadding="0" align="center" cellspacing="0" border="0" class="ctable" style="border-left:1px solid #99bbe8;border-bottom:1px solid #99bbe8;border-right:0px solid red;">
    <tr >
      <td width="30%">用户名：</td>
      <td >
      	<input type="text"  maxlength="20" style="width:120px;" class="textInput" value="<%=loginName %>" readonly/>
      </td>
     </tr>
     <tr>
      <td>扣除金额：</td>
      <td width="30%" >
		<input type="text"  maxlength="20" name="money" style="width:120px;" class="textInput" id="money1" rule="number"  label="扣费金额" error="必须为正整数"/>
	  </td>
    </tr>
    <tr >
      <td>确认金额：</td>
      <td>
	  	<input type="text"  maxlength="20" style="width:120px;" class="textInput" id="money2"  rule="number"   label="确认金额" error="必须为正整数"/>
	  </td>
    </tr>
     <tr height="100">
      <td>说明：</td>
      <td>
	  	 <textAREA name="MARK" style="width:200px;height:80px;overflow:auto;" ></textAREA>
	  </td>
    </tr>
  </table>
</div>
</form>
</body> 
</html>